package com.tone.ji_volunteer.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @author tone(ang)
 * version 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Activity {
    private Integer id;
    private String Creator;
    private Integer userId;
    private String openid;
    private String title;
    private LocalDateTime createTime;
    private LocalDateTime endTime;
    private String content;
    private Short state;
    private String province;
    private String city;
    private String region;
    private String detail;
    private String contactInfo;

    public void setState(Short state){
        // 比较时间
        LocalDateTime now = LocalDateTime.now();
        if (this.endTime == null||now.compareTo(endTime) < 0) {
            this.state = 1;
        } else if (now.compareTo(endTime) >= 0) {
            this.state = 0;
        }
    }
}
